$(function(){
	
	$(".checkAll").click(function(){
		$(".checkBox").each(function(){
			if($(".checkAll input").attr("checked")){
				$(this).attr("checked",true);
			}else{
				$(this).attr("checked",false);
			}
		});
	});
	
	/*$(".articleUL").hover(function(){
		 					$(this).css('background','yellow');
						  },
						  function(){
							  $(this).css("background",'');
						  });*/
	
	$(".delete").click(function(){
		if($(this).parent().parent().find('input[type="checkbox"]').attr("checked")){
				var url = 'deleteAlbum';
				
				var data = {"aid":$(this).find('input').val()};
				$.post(url,
					   data,
					   function(data){
							$.blockUI({ message: $('#deleteFeedBack')  });
							setTimeout(function(){
							$.unblockUI();
								window.location.href='preAlbumManager';
							},2000);
				 	    },
					   'html'
				);
		}else{
			$.blockUI({ message: $('#deleteCheck')  });
			setTimeout(function(){
			$.unblockUI();
			},2000);
		}
	});
	
	$("#batchDelete").click(function(){
		
		var albumIds = "";
		$(".checkBox").each(function(){
			if($(this).attr("checked")){
				if(albumIds == ""){
					albumIds = $(this).parent().parent().find(".delete input").val();
				}else{
					albumIds = albumIds + "_" + $(this).parent().parent().find(".delete input").val();
				}
			   
			}
		});
		if(albumIds != ""){
				var url = 'deleteAlbum';
				
				var data = {"aid":albumIds};
				$.post(url,
					   data,
					   function(data){
							$.blockUI({ message: $('#deleteFeedBack')  });
							setTimeout(function(){
							$.unblockUI();
								window.location.href='preAlbumManager';
							},2000);
				 	    },
					   'html'
				);
		}else{
			$.blockUI({ message: $('#deleteCheck')  });
			setTimeout(function(){
			$.unblockUI();
			},2000);
		}
	});
	
});